/**Tree shaking 的作用：消除无用的 JS 代码，只对使用 export 导出的变量生效 */
import { Base64 } from 'js-base64';
export function targetType(target) {
  return Object.prototype.toString.call(target).slice(8, -1).toLowerCase();
}
export function deepClone(target) {
  return JSON.parse(JSON.stringify(target));
}

//base64
export function expmale_base64() {
  let latin = 'dankogai';
  let utf8 = '小飼弾';
  let u8s = new Uint8Array([100, 97, 110, 107, 111, 103, 97, 105]);
  Base64.encode(latin); // ZGFua29nYWk=
  console.log(Base64.encode(latin, true)); // ZGFua29nYWk skips padding
  console.log(Base64.encodeURI(latin)); // ZGFua29nYWk
  Base64.fromUint8Array(u8s); // ZGFua29nYWk=
  Base64.fromUint8Array(u8s, true); // ZGFua29nYW which is URI safe
  Base64.encode(utf8); // 5bCP6aO85by+
  Base64.encode(utf8, true); // 5bCP6aO85by-
  console.log(Base64.encodeURI(utf8)); // 5bCP6aO85by-
  console.log(Base64.encode(latin));
}
